package com.springboot.spring01ioc.conditional;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.lang.annotation.Annotation;

public class MacConditional implements Condition {

    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String osNmae = context.getEnvironment().getProperty("OS");
        if(osNmae != null && osNmae.contains("Mac")){
            return true;
        }
        return false;
    }
}
